package com.tidaodang.service.goods;


import com.tidaodang.common.util.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@EnableEurekaClient//声明当前工程时Eureka客户端
@MapperScan(basePackages = {"com.tidaodang.service.goods.dao"})
public class GoodsApplication {

    @Value("${workId}")
    private int workId;

    @Value("${datacenterId}")
    private int datacenterId;

    public static void main(String[] args) {
        SpringApplication.run(GoodsApplication.class, args);
    }

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workId, datacenterId);
    }
}
